home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / wais / waisgate / HText.h < prev    next >
C/C++ Source or Header  |  1995-05-09  |  6KB  |  177 lines

  1. /*  */
  2.  
  3. /*                      HyperText Object                        HText.h
  4. **                      ================
  5. **      This is the C interface to the Objective-C HyperText class.
  6. */
  7.  
  8. #ifndef HTEXT_H
  9. #define HTEXT_H
  10. #include "HTAnchor.h"
  11. #include "HTStyle.h"
  12. #include "HTStream.h"
  13.  
  14. #ifdef SHORT_NAMES
  15. #define HTMainText                      HTMaText
  16. #define HTMainAnchor                    HtMaAnch
  17. #define HText_new                       HTHTNew
  18. #define HText_free                      HTHTFree
  19. #define HText_beginAppend               HTHTBeAp
  20. #define HText_endAppend                 HTHTEnAp
  21. #define HText_setStyle                  HTHTSeSt
  22. #define HText_appendCharacter           HTHTApCh
  23. #define HText_appendText                HTHTApTe
  24. #define HText_appendParagraph           HTHTApPa
  25. #define HText_beginAnchor               HTHTBeAn
  26. #define HText_endAnchor                 HTHTEnAn
  27. #define HText_dump                      HTHTDump
  28. #define HText_nodeAnchor                HTHTNoAn
  29. #define HText_select                    HTHTSele
  30. #define HText_selectAnchor              HTHTSeAn
  31. #define HText_applyStyle                HTHTApSt
  32. #define HText_updateStyle               HTHTUpSt
  33. #define HText_selectionStyle            HTHTStyl
  34. #define HText_replaceSel                HTHTRepl
  35. #define HText_applyToSimilar            HTHTApTo
  36. #define HText_selectUnstyled            HTHTSeUn
  37. #define HText_unlinkSelection           HTHTUnSe
  38. #define HText_linkSelTo                 HTHTLiSe
  39. #define HText_referenceSelected         HTHTRefS
  40. #endif
  41.  
  42. #ifndef THINK_C
  43. #ifndef HyperText               /* Objective C version defined HyperText */
  44. typedef struct _HText HText;    /* Normal Library */
  45. #endif
  46. #else
  47. class CHyperText;               /* Mac Think-C browser hook */
  48. typedef CHyperText HText;
  49. #endif
  50.  
  51. extern HText * HTMainText;              /* Pointer to current main text */
  52. extern HTParentAnchor * HTMainAnchor;   /* Pointer to current text's anchor */
  53.  
  54. /*                      Creation and deletion
  55. **
  56. **      Create hypertext object                                 HText_new
  57. */
  58.  extern HText * HText_new PARAMS((HTParentAnchor * anchor));
  59.  extern HText * HText_new2 PARAMS((HTParentAnchor * anchor,
  60.                                 HTStream * output_stream));
  61.  
  62. /*      Free hypertext object                                   HText_free
  63. */
  64. extern void     HText_free PARAMS((HText * me));
  65.  
  66.  
  67. /*                      Object Building methods
  68. **                      -----------------------
  69. **
  70. **      These are used by a parser to build the text in an object
  71. **      HText_beginAppend must be called, then any combination of other
  72. **      append calls, then HText_endAppend. This allows optimised
  73. **      handling using buffers and caches which are flushed at the end.
  74. */
  75. extern void HText_beginAppend PARAMS((HText * text));
  76.  
  77. extern void HText_endAppend PARAMS((HText * text));
  78.  
  79. /*      Set the style for future text
  80. */
  81. extern void HText_setStyle PARAMS((HText * text, HTStyle * style));
  82.  
  83. /*      Add one character
  84. */
  85. extern void HText_appendCharacter PARAMS((HText * text, char ch));
  86.  
  87. /*      Add a zero-terminated string
  88. */
  89. extern void HText_appendText PARAMS((HText * text, CONST char * str));
  90.  
  91. /*      New Paragraph
  92. */
  93. extern void HText_appendParagraph PARAMS((HText * text));
  94.  
  95. /*      Start/end sensitive text
  96. **
  97. ** The anchor object is created and passed to HText_beginAnchor.
  98. ** The senstive text is added to the text object, and then HText_endAnchor
  99. ** is called. Anchors may not be nested.
  100. */
  101.  
  102. extern void HText_beginAnchor PARAMS((HText * text, HTChildAnchor * anc));
  103. extern void HText_endAnchor PARAMS((HText * text));
  104.  
  105.  
  106. /*      Dump diagnostics to stderr
  107. */
  108. extern void HText_dump PARAMS((HText * me));
  109.  
  110. /*      Return the anchor associated with this node
  111. */
  112. extern HTParentAnchor * HText_nodeAnchor PARAMS((HText * me));
  113.  
  114.  
  115. /*              Browsing functions
  116. **              ------------------
  117. */
  118.  
  119. /*      Bring to front and highlight it
  120. */
  121.  
  122. extern BOOL HText_select PARAMS((HText * text));
  123. extern BOOL HText_selectAnchor PARAMS((HText * text, HTChildAnchor* anchor));
  124.  
  125. /*              Editing functions
  126. **              -----------------
  127. **
  128. **      These are called from the application. There are many more functions
  129. **      not included here from the orginal text object. These functions
  130. **      NEED NOT BE IMPLEMENTED in a browser which cannot edit.
  131. */
  132.  
  133. /*      Style handling:
  134. */
  135. /*      Apply this style to the selection
  136. */
  137. extern void HText_applyStyle PARAMS((HText * me, HTStyle *style));
  138.  
  139. /*      Update all text with changed style.
  140. */
  141. extern void HText_updateStyle PARAMS((HText * me, HTStyle *style));
  142.  
  143. /*      Return style of  selection
  144. */
  145. extern HTStyle * HText_selectionStyle PARAMS((
  146.         HText * me,
  147.         HTStyleSheet* sheet));
  148.  
  149. /*      Paste in styled text
  150. */
  151. extern void HText_replaceSel PARAMS((HText * me,
  152.         CONST char *aString,
  153.         HTStyle* aStyle));
  154.  
  155. /*      Apply this style to the selection and all similarly formatted text
  156. **      (style recovery only)
  157. */
  158. extern void HTextApplyToSimilar PARAMS((HText * me, HTStyle *style));
  159.  
  160. /*      Select the first unstyled run.
  161. **      (style recovery only)
  162. */
  163. extern void HTextSelectUnstyled PARAMS((HText * me, HTStyleSheet *sheet));
  164.  
  165.  
  166. /*      Anchor handling:
  167. */
  168. extern void             HText_unlinkSelection PARAMS((HText * me));
  169. extern HTAnchor *       HText_referenceSelected PARAMS((HText * me));
  170. extern HTAnchor *       HText_linkSelTo PARAMS((HText * me, HTAnchor* anchor));
  171.  
  172.  
  173. #endif /* HTEXT_H */
  174. /*
  175.  
  176.     */
  177.